cmake_minimum_required(VERSION 3.22)

project(PH)
add_library(Protocol INTERFACE)

# Enable CMake support for ASM and C languages
enable_language(C ASM)

target_include_directories(Protocol INTERFACE
    Modbus/Inc
    M01_Distance/Inc
    Ymodem/Inc
    ${CMAKE_CURRENT_SOURCE_DIR}

)

target_sources(Protocol INTERFACE

    cbb_ph_obj.c
    M01_Distance/Src/cbb_ph_m01_dis.c
    Modbus/Src/cbb_ph_mb_slave.c
    Modbus/Src/cbb_ph_mb_master.c

    Ymodem/Src/cbb_ph_ymodem_slave.c
)

# Validate that STM32CubeMX code is compatible with C standard
if(CMAKE_C_STANDARD LESS 11)
    message(ERROR "Generated code requires C11 or higher")
endif()


